VTABLE(_Stack) {
    <empty>
    Stack
    _Stack.Init;
    _Stack.Push;
    _Stack.Pop;
    _Stack.NumElems;
}

FUNCTION(_Stack_New) {
memo ''
_Stack_New:
    _T5 = 12
    parm _T5
    _T6 =  call _Alloc
    _T7 = 0
    *(_T6 + 4) = _T7
    *(_T6 + 8) = _T7
    _T8 = VTBL <_Stack>
    *(_T6 + 0) = _T8
    return _T6
}

FUNCTION(_Stack.Init) {
memo '_T0:4'
_Stack.Init:
    _T9 = *(_T0 + 8)
    _T10 = 100
    _T11 = 0
    _T12 = (_T10 < _T11)
    if (_T12 == 0) branch _L14
    _T13 = "Decaf runtime error: Cannot create negative-sized array\n"
    parm _T13
    call _PrintString
    call _Halt
_L14:
    _T14 = 4
    _T15 = (_T14 * _T10)
    _T16 = (_T14 + _T15)
    parm _T16
    _T17 =  call _Alloc
    *(_T17 + 0) = _T10
    _T18 = 0
    _T17 = (_T17 + _T16)
_L15:
    _T16 = (_T16 - _T14)
    if (_T16 == 0) branch _L16
    _T17 = (_T17 - _T14)
    *(_T17 + 0) = _T18
    branch _L15
_L16:
    *(_T0 + 8) = _T17
    _T19 = *(_T0 + 4)
    _T20 = 0
    *(_T0 + 4) = _T20
    _T21 = 3
    parm _T0
    parm _T21
    _T22 = *(_T0 + 0)
    _T23 = *(_T22 + 12)
    call _T23
}

FUNCTION(_Stack.Push) {
memo '_T1:4 _T2:8'
_Stack.Push:
    _T24 = *(_T1 + 8)
    _T25 = *(_T1 + 4)
    _T26 = *(_T24 - 4)
    _T27 = (_T25 < _T26)
    if (_T27 == 0) branch _L17
    _T28 = 0
    _T29 = (_T25 < _T28)
    if (_T29 == 0) branch _L18
_L17:
    _T30 = "Decaf runtime error: Array subscript out of bounds\n"
    parm _T30
    call _PrintString
    call _Halt
_L18:
    _T31 = 4
    _T32 = (_T25 * _T31)
    _T33 = (_T24 + _T32)
    _T34 = *(_T33 + 0)
    _T35 = 4
    _T36 = (_T25 * _T35)
    _T37 = (_T24 + _T36)
    *(_T37 + 0) = _T2
    _T38 = *(_T1 + 4)
    _T39 = *(_T1 + 4)
    _T40 = 1
    _T41 = (_T39 + _T40)
    *(_T1 + 4) = _T41
}

FUNCTION(_Stack.Pop) {
memo '_T3:4'
_Stack.Pop:
    _T43 = *(_T3 + 8)
    _T44 = *(_T3 + 4)
    _T45 = 1
    _T46 = (_T44 - _T45)
    _T47 = *(_T43 - 4)
    _T48 = (_T46 < _T47)
    if (_T48 == 0) branch _L19
    _T49 = 0
    _T50 = (_T46 < _T49)
    if (_T50 == 0) branch _L20
_L19:
    _T51 = "Decaf runtime error: Array subscript out of bounds\n"
    parm _T51
    call _PrintString
    call _Halt
_L20:
    _T52 = 4
    _T53 = (_T46 * _T52)
    _T54 = (_T43 + _T53)
    _T55 = *(_T54 + 0)
    _T42 = _T55
    _T56 = *(_T3 + 4)
    _T57 = *(_T3 + 4)
    _T58 = 1
    _T59 = (_T57 - _T58)
    *(_T3 + 4) = _T59
    return _T42
}

FUNCTION(_Stack.NumElems) {
memo '_T4:4'
_Stack.NumElems:
    _T60 = *(_T4 + 4)
    return _T60
}

FUNCTION(main) {
memo ''
main:
    _T62 =  call _Stack_New
    _T61 = _T62
    parm _T61
    _T63 = *(_T61 + 0)
    _T64 = *(_T63 + 8)
    call _T64
    _T65 = 3
    parm _T61
    parm _T65
    _T66 = *(_T61 + 0)
    _T67 = *(_T66 + 12)
    call _T67
    _T68 = 7
    parm _T61
    parm _T68
    _T69 = *(_T61 + 0)
    _T70 = *(_T69 + 12)
    call _T70
    _T71 = 4
    parm _T61
    parm _T71
    _T72 = *(_T61 + 0)
    _T73 = *(_T72 + 12)
    call _T73
    parm _T61
    _T74 = *(_T61 + 0)
    _T75 = *(_T74 + 20)
    _T76 =  call _T75
    parm _T76
    call _PrintInt
    _T77 = " "
    parm _T77
    call _PrintString
    parm _T61
    _T78 = *(_T61 + 0)
    _T79 = *(_T78 + 16)
    _T80 =  call _T79
    parm _T80
    call _PrintInt
    _T81 = " "
    parm _T81
    call _PrintString
    parm _T61
    _T82 = *(_T61 + 0)
    _T83 = *(_T82 + 16)
    _T84 =  call _T83
    parm _T84
    call _PrintInt
    _T85 = " "
    parm _T85
    call _PrintString
    parm _T61
    _T86 = *(_T61 + 0)
    _T87 = *(_T86 + 16)
    _T88 =  call _T87
    parm _T88
    call _PrintInt
    _T89 = " "
    parm _T89
    call _PrintString
    parm _T61
    _T90 = *(_T61 + 0)
    _T91 = *(_T90 + 20)
    _T92 =  call _T91
    parm _T92
    call _PrintInt
}

